import { NestFactory } from '@nestjs/core';
import {DocumentBuilder, SwaggerModule} from '@nestjs/swagger'
import { AppModule } from './app.module';
import {NestExpressApplication} from '@nestjs/platform-express'

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);

  const swaggerOptions = new DocumentBuilder()
                          .setTitle('nest-starter api document')
                          .setDescription('nest starter project api document')
                          .setVersion('1.0')
                          .addBearerAuth()
                          .build();
  const document = SwaggerModule.createDocument(app, swaggerOptions);
  SwaggerModule.setup('doc', app, document)

  app.setGlobalPrefix('book')
  app.useStaticAssets('public', {
    prefix: '/static/' //配置虚拟目录
  }) // 配置静态资源
  await app.listen(3000);
}
bootstrap();
